package com.miao.test.common.enums;

import java.util.Arrays;

/**
 * @Auther: miaoguoxin
 * @Date: 2021/2/25 17:29
 * @Description:
 */
public enum EventType {
    SAVE_OFFLINE_MSG(1, "存储离线消息"),
    ;

    private int code;

    private String value;

    EventType(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public static EventType getByCode(int code) {
        return Arrays.stream(EventType.values())
                .filter(e -> e.getCode() == code)
                .findFirst()
                .orElse(null);
    }

    public int getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }
}
